package com.easylinkin.linkappapi.hcmy.controller;

import com.easylinkin.linkappapi.hcmy.service.CarLocusService;
import com.easylinkin.linkappapi.positioning.entity.MonitorMapDevice;
import com.easylinkin.linkappapi.positioning.entity.MonitorMapStatistics;
import com.easylinkin.linkappapi.positioning.entity.QueryMonitorMap;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import site.morn.rest.RestBuilders;
import site.morn.rest.RestMessage;

import javax.annotation.Resource;
import java.util.List;

/**
 * class info :汉川面源--车辆轨迹
 *
 * @author liuqihang
 * @date 2021/9/22 10:51
 */
@RestController
@RequestMapping("/carLocus")
public class CarLocusController {

    @Resource
    private CarLocusService carLocusService;

    @PostMapping("getStatistics")
    public RestMessage getStatisticsInfo(@RequestBody QueryMonitorMap queryMonitorMap) {
        Assert.notNull(queryMonitorMap, "queryMonitorMap 不能为空");
        MonitorMapStatistics statisticsInfo = carLocusService.getStatisticsInfo(queryMonitorMap);
        return RestBuilders.successBuilder().data(statisticsInfo).build();
    }

    @PostMapping("getDeviceList")
    public RestMessage getDeviceList(@RequestBody QueryMonitorMap queryMonitorMap) {
        Assert.notNull(queryMonitorMap, "queryMonitorMap 不能为空");
        List<MonitorMapDevice> deviceList = carLocusService.getDeviceList(queryMonitorMap);
        return RestBuilders.successBuilder().data(deviceList).build();
    }


}
